package jp.co.neosystem.s2wg.util;

import jp.co.neosystem.s2wg.dto.flex.Status;

public class StatusFactory {

	public static Status getStatus(final MessageCode code,
			final String message, final String traceInfo) {
		final Status status = new Status();

		status.setCode(code.getCode());
		status.setMessage(message);
		status.setTraceInfo(traceInfo);

		return status;
	}

	public static Status getStatus(final MessageCode code,
			final String message, final Throwable t) {
		return StatusFactory.getStatus(code, message, Logger.getStackTrace(t));
	}

	public static Status getStatus(final MessageCode code, final String message) {
		return StatusFactory.getStatus(code, message, "");
	}

	public static Status getStatus(final MessageCode code, final Throwable t) {
		return StatusFactory.getStatus(code, code.getMessage(), t);
	}

	public static Status getStatus(final MessageCode code) {
		return StatusFactory.getStatus(code, code.getMessage());
	}
}
